import 'package:speed_random/generated/json/base/json_convert_content.dart';
import 'package:speed_random/generated/mode_app_info_entity.dart';

ModeAppInfoEntity $ModeAppInfoEntityFromJson(Map<String, dynamic> json) {
  final ModeAppInfoEntity modeAppInfoEntity = ModeAppInfoEntity();
  final ModeAppInfoSoft? soft = jsonConvert.convert<ModeAppInfoSoft>(
      json['soft']);
  if (soft != null) {
    modeAppInfoEntity.soft = soft;
  }
  final ModeAppInfoCh? ch = jsonConvert.convert<ModeAppInfoCh>(json['ch']);
  if (ch != null) {
    modeAppInfoEntity.ch = ch;
  }
  final List<ModeAppInfoCommodity>? commodity = (json['commodity'] as List<
      dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<ModeAppInfoCommodity>(e) as ModeAppInfoCommodity)
      .toList();
  if (commodity != null) {
    modeAppInfoEntity.commodity = commodity;
  }
  final List<ModeAppInfoApps>? apps = (json['apps'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<ModeAppInfoApps>(e) as ModeAppInfoApps)
      .toList();
  if (apps != null) {
    modeAppInfoEntity.apps = apps;
  }
  return modeAppInfoEntity;
}

Map<String, dynamic> $ModeAppInfoEntityToJson(ModeAppInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['soft'] = entity.soft?.toJson();
  data['ch'] = entity.ch?.toJson();
  data['commodity'] = entity.commodity?.map((v) => v.toJson()).toList();
  data['apps'] = entity.apps?.map((v) => v.toJson()).toList();
  return data;
}

extension ModeAppInfoEntityExtension on ModeAppInfoEntity {
  ModeAppInfoEntity copyWith({
    ModeAppInfoSoft? soft,
    ModeAppInfoCh? ch,
    List<ModeAppInfoCommodity>? commodity,
    List<ModeAppInfoApps>? apps,
  }) {
    return ModeAppInfoEntity()
      ..soft = soft ?? this.soft
      ..ch = ch ?? this.ch
      ..commodity = commodity ?? this.commodity
      ..apps = apps ?? this.apps;
  }
}

ModeAppInfoSoft $ModeAppInfoSoftFromJson(Map<String, dynamic> json) {
  final ModeAppInfoSoft modeAppInfoSoft = ModeAppInfoSoft();
  final String? serviceUrl = jsonConvert.convert<String>(json['service_url']);
  if (serviceUrl != null) {
    modeAppInfoSoft.serviceUrl = serviceUrl;
  }
  final String? webUrl = jsonConvert.convert<String>(json['web_url']);
  if (webUrl != null) {
    modeAppInfoSoft.webUrl = webUrl;
  }
  final String? deal = jsonConvert.convert<String>(json['deal']);
  if (deal != null) {
    modeAppInfoSoft.deal = deal;
  }
  final String? dealu = jsonConvert.convert<String>(json['dealu']);
  if (dealu != null) {
    modeAppInfoSoft.dealu = dealu;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    modeAppInfoSoft.id = id;
  }
  return modeAppInfoSoft;
}

Map<String, dynamic> $ModeAppInfoSoftToJson(ModeAppInfoSoft entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['service_url'] = entity.serviceUrl;
  data['web_url'] = entity.webUrl;
  data['deal'] = entity.deal;
  data['dealu'] = entity.dealu;
  data['id'] = entity.id;
  return data;
}

extension ModeAppInfoSoftExtension on ModeAppInfoSoft {
  ModeAppInfoSoft copyWith({
    String? serviceUrl,
    String? webUrl,
    String? deal,
    String? dealu,
    int? id,
  }) {
    return ModeAppInfoSoft()
      ..serviceUrl = serviceUrl ?? this.serviceUrl
      ..webUrl = webUrl ?? this.webUrl
      ..deal = deal ?? this.deal
      ..dealu = dealu ?? this.dealu
      ..id = id ?? this.id;
  }
}

ModeAppInfoCh $ModeAppInfoChFromJson(Map<String, dynamic> json) {
  final ModeAppInfoCh modeAppInfoCh = ModeAppInfoCh();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    modeAppInfoCh.id = id;
  }
  final int? sSoftid = jsonConvert.convert<int>(json['s_softid']);
  if (sSoftid != null) {
    modeAppInfoCh.sSoftid = sSoftid;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    modeAppInfoCh.type = type;
  }
  final int? ver = jsonConvert.convert<int>(json['ver']);
  if (ver != null) {
    modeAppInfoCh.ver = ver;
  }
  final String? showver = jsonConvert.convert<String>(json['showver']);
  if (showver != null) {
    modeAppInfoCh.showver = showver;
  }
  final String? updateContent = jsonConvert.convert<String>(
      json['update_content']);
  if (updateContent != null) {
    modeAppInfoCh.updateContent = updateContent;
  }
  final String? updateUrl = jsonConvert.convert<String>(json['update_url']);
  if (updateUrl != null) {
    modeAppInfoCh.updateUrl = updateUrl;
  }
  final String? rateUrl = jsonConvert.convert<String>(json['rate_url']);
  if (rateUrl != null) {
    modeAppInfoCh.rateUrl = rateUrl;
  }
  return modeAppInfoCh;
}

Map<String, dynamic> $ModeAppInfoChToJson(ModeAppInfoCh entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['s_softid'] = entity.sSoftid;
  data['type'] = entity.type;
  data['ver'] = entity.ver;
  data['showver'] = entity.showver;
  data['update_content'] = entity.updateContent;
  data['update_url'] = entity.updateUrl;
  data['rate_url'] = entity.rateUrl;
  return data;
}

extension ModeAppInfoChExtension on ModeAppInfoCh {
  ModeAppInfoCh copyWith({
    int? id,
    int? sSoftid,
    String? type,
    int? ver,
    String? showver,
    String? updateContent,
    String? updateUrl,
    String? rateUrl,
  }) {
    return ModeAppInfoCh()
      ..id = id ?? this.id
      ..sSoftid = sSoftid ?? this.sSoftid
      ..type = type ?? this.type
      ..ver = ver ?? this.ver
      ..showver = showver ?? this.showver
      ..updateContent = updateContent ?? this.updateContent
      ..updateUrl = updateUrl ?? this.updateUrl
      ..rateUrl = rateUrl ?? this.rateUrl;
  }
}

ModeAppInfoCommodity $ModeAppInfoCommodityFromJson(Map<String, dynamic> json) {
  final ModeAppInfoCommodity modeAppInfoCommodity = ModeAppInfoCommodity();
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    modeAppInfoCommodity.type = type;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    modeAppInfoCommodity.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    modeAppInfoCommodity.title = title;
  }
  final String? price = jsonConvert.convert<String>(json['price']);
  if (price != null) {
    modeAppInfoCommodity.price = price;
  }
  final String? uptype = jsonConvert.convert<String>(json['uptype']);
  if (uptype != null) {
    modeAppInfoCommodity.uptype = uptype;
  }
  final String? upnum = jsonConvert.convert<String>(json['upnum']);
  if (upnum != null) {
    modeAppInfoCommodity.upnum = upnum;
  }
  return modeAppInfoCommodity;
}

Map<String, dynamic> $ModeAppInfoCommodityToJson(ModeAppInfoCommodity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type;
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['price'] = entity.price;
  data['uptype'] = entity.uptype;
  data['upnum'] = entity.upnum;
  return data;
}

extension ModeAppInfoCommodityExtension on ModeAppInfoCommodity {
  ModeAppInfoCommodity copyWith({
    String? type,
    String? id,
    String? title,
    String? price,
    String? uptype,
    String? upnum,
  }) {
    return ModeAppInfoCommodity()
      ..type = type ?? this.type
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..price = price ?? this.price
      ..uptype = uptype ?? this.uptype
      ..upnum = upnum ?? this.upnum;
  }
}

ModeAppInfoApps $ModeAppInfoAppsFromJson(Map<String, dynamic> json) {
  final ModeAppInfoApps modeAppInfoApps = ModeAppInfoApps();
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    modeAppInfoApps.title = title;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    modeAppInfoApps.id = id;
  }
  final String? logo = jsonConvert.convert<String>(json['logo']);
  if (logo != null) {
    modeAppInfoApps.logo = logo;
  }
  final String? updateUrl = jsonConvert.convert<String>(json['update_url']);
  if (updateUrl != null) {
    modeAppInfoApps.updateUrl = updateUrl;
  }
  return modeAppInfoApps;
}

Map<String, dynamic> $ModeAppInfoAppsToJson(ModeAppInfoApps entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['title'] = entity.title;
  data['id'] = entity.id;
  data['logo'] = entity.logo;
  data['update_url'] = entity.updateUrl;
  return data;
}

extension ModeAppInfoAppsExtension on ModeAppInfoApps {
  ModeAppInfoApps copyWith({
    String? title,
    int? id,
    String? logo,
    String? updateUrl,
  }) {
    return ModeAppInfoApps()
      ..title = title ?? this.title
      ..id = id ?? this.id
      ..logo = logo ?? this.logo
      ..updateUrl = updateUrl ?? this.updateUrl;
  }
}